<template>
  <div class="container">
    <el-page-header
      @back="goBack"
      title="套餐管理"
      style="padding: 10px 20px"
    />
    <el-form :model="mealForm" style="padding: 20px">
      <el-form-item label="套餐名称">
        <span>{{ mealForm.comboName }}</span>
      </el-form-item>
      <el-form-item label="食堂名称">
        <span>{{ mealForm.comboCanteenName }}</span>
      </el-form-item>
      <el-form-item label="餐标价格">
        <span>{{ mealForm.comboPrice + "元" }}</span>
      </el-form-item>
      <el-form-item label="套餐详情">
        <div
          style="border: 1px solid #cccccc; border-radius: 5px; padding: 20px"
          v-html="mealForm.comboImage"
        ></div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
//套餐ID
import { onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { mealInfo } from "@/api/canteen/meal";
const mealId = ref("");
const route = useRoute();
const router = useRouter();
//套餐详情数据
const mealForm = ref({});
function goBack() {
  router.back();
}
//获取套餐详情
function getMealInfo() {
  mealInfo(mealId.value).then((res) => {
    mealForm.value = res.data;
    console.log(res);
  });
}
onMounted(() => {
  mealId.value = route.query.id;
  getMealInfo();
});
</script>
<style scoped lang="scss">
.container {
  height: calc(100vh - 200px);
  background: #ffffff;
  box-shadow: 0 0 16px rgba(96, 96, 96, 0.16);
  border-radius: 6px;
  padding: 20px;
  overflow-y: auto;
  margin-top: 20px;
  .hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
.el-form-item {
  margin-bottom: 0px;
}
</style>
